<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文章类别</title>
    <!-- 引进token -->
    <script src="/assets/js/token.js"></script>
    <!-- 引进layui.css -->
    <link rel="stylesheet" href="/assets/lib/layui/css/layui.css">
    <!-- 引进article.css -->
    <link rel="stylesheet" href="/assets/css/article/article.css">
</head>

<body>

    <div class="layui-card">

        <div class="layui-card-header">
            <span>文章类别管理</span>
            <button type="button" id="showAdd" class="layui-btn layui-btn-sm layui-btn-normal">添加类别</button>
        </div>

        <div class="layui-card-body">
            <table class="layui-table">
                <colgroup>
                    <col width="470">
                    <col width="470">
                    <col>
                </colgroup>
                <thead>
                    <tr>
                        <th>分类名称</th>
                        <th>分类别名</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <!-- <tr>
                        <td>贤心</td>
                        <td>2016-11-29</td>
                        <td>
                            <button type="button" class="layui-btn   layui-btn-xs">编辑</button>
                            <button type="button" class="layui-btn layui-btn-danger   layui-btn-xs">删除</button>
                        </td>
                    </tr> -->
                </tbody>
            </table>
        </div>
    </div>


    <!-- 引进jquery -->
    <script src="/assets/lib/jquery.js"></script>
    <!-- 引进模板引擎 -->
    <script src="/assets/lib/template-web.js"></script>
    <!-- 引进layui -->
    <script src="/assets/lib/layui/layui.all.js"></script>
    <!-- 引进baseAPI -->
    <script src="/assets/js/baseAPI.js"></script>
    <!-- 引进article -->
    <script src="/assets/js/article/article.js"></script>
    <!-- 渲染 -->
    <script type="text/html" id="tpl-article">
        {{each data val}}
        <tr>
            <td>{{val.name}}</td>
            <td>{{val.alias}}</td>
            <td>
                <button  id="btn" type="button" class="layui-btn  compile  layui-btn-xs" data-Id="{{val.Id}}"
                    data-name="{{val.name}}" data-alias="{{val.alias}}">编辑</button>
                <button data-id="{{val.Id}}" type="button"
                    class="layui-btn layui-btn-danger layui-btn-xs deletecate">删除</button>
            </td>
        </tr>
        {{/each}}
    </script>
    <!-- 添加分类 -->
    <script type="text/html" id="tpl-add">
        <form id="form-add" class="layui-form" lay-filter="f2" action="" style="margin-top:20px; margin-right:30px">
            <!-- <input type="hidden" name="Id"> -->
            <!-- 第一行 分类名称-->
            <div class="layui-form-item">
                <label class="layui-form-label">分类名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required lay-verify="required" placeholder="请输入名称" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <!-- 第二行 分类别名 -->
            <div class="layui-form-item">
                <label class="layui-form-label">分类别名</label>
                <div class="layui-input-block">
                    <input type="text" name="alias" required lay-verify="required" placeholder="请输入别名"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <!-- 第三行 按钮 -->
            <div class="layui-form-item">
                <div class="layui-input-block">

                    <button class="layui-btn" lay-submit lay-filter="formDemo" id="confirm-add">确认添加</button>

                </div>
            </div>
        </form>
    </script>
    <!-- 编辑分类 -->
    <script type="text/html" id="tpl-compile">
        <form id="form-compile" class="layui-form" lay-filter="f2" action="" style="margin-top:20px; margin-right:30px">
            <!-- 第一行 分类名称-->
            <!-- <input type="hidden" name="id"> -->
            <div class="layui-form-item">
                <label class="layui-form-label">分类名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required lay-verify="required" placeholder="请输入名称" autocomplete="off"
                        class="layui-input">
                </div>
            </div>
            <!-- 第二行 分类别名 -->
            <div class="layui-form-item">
                <label class="layui-form-label">分类别名</label>
                <div class="layui-input-block">
                    <input type="text" name="alias" required lay-verify="required" placeholder="请输入别名"
                        autocomplete="off" class="layui-input">
                </div>
            </div>
            <!-- 第三行 按钮 -->
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="hidden"  name="id"/>
                    <button class="layui-btn" lay-submit lay-filter="formDemo" id="confirm-add">确认修改</button>
                </div>
            </div>
        </form>
    </script>
</body>

</html>